<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "goods_introduction".
 *
 * @property int $id ID
 * @property string $introduction 介绍内容
 * @property string $goods_no 商品编号
 * @property int $addtime 添加时间
 */
class GoodsIntroduction extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'goods_introduction';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['introduction', 'goods_no', 'addtime'], 'required'],
            [['introduction'], 'string'],
            [['goods_no', 'addtime'], 'integer'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'introduction' => '介绍内容',
            'goods_no' => '商品编号',
            'addtime' => '添加时间',
        ];
    }
    
    
    public static function getIntroduction($goods_no){
        $sql = "select introduction from goods_introduction where goods_no=$goods_no";
        $command = \Yii::$app->db->createCommand($sql);
        $data = $command->queryOne();
        return $data['introduction'];
    }
}
